home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor1 / radicals.src < prev    next >
Text File  |  1991-05-29  |  2KB  |  97 lines

  1. %%HP:T(3)F(.);
  2. @ RADICALS, by Michael Andrew Lowry
  3. DIR
  4.   SQ\->Q
  5.     \<< SQ 8 SCI \->Q STD
  6.     \>>
  7.   \->RDCL
  8.     \<< SQ 8 SCI \->Q STD DUP
  9.       IF TYPE 9 ==
  10.       THEN OBJ\-> DROP2 'K' STO 'J' STO
  11.       ELSE 'J' STO 1 'K' STO
  12.       END 1 'A' STO 1 'B' STO 1 'C' STO 1 'D' STO J PF 'A' 'C' FCTOR K PF 'B'
  13. 'D' FCTOR B.A.E.
  14.     \>>
  15.   FCTOR
  16.     \<< \-> ov iv
  17.       \<<
  18.         WHILE DUP SIZE DUP 1 >
  19.         REPEAT \-> j s
  20.           \<< j 1 2 SUB OBJ\-> DROP DUP2
  21.             IF ==
  22.             THEN ov STO* DROP j 3
  23.             ELSE DROP iv STO* j 2
  24.             END s SUB
  25.           \>>
  26.         END DROP OBJ\->
  27.         IF 0 \=/
  28.         THEN iv STO*
  29.         END
  30.       \>>
  31.     \>>
  32.   SIMPL
  33.     \<<
  34.       IF C D / FP 0 \=/
  35.       THEN
  36.         IF B SQ C * D / DUP FP 0 ==
  37.         THEN 'C' STO 1 'D' STO B SQ 'B' STO
  38.         ELSE DROP
  39.         END
  40.       END
  41.     \>>
  42.   B.A.E.
  43.     \<< 39 CHR
  44.       IF A B / 1 \=/
  45.       THEN A \->STR +
  46.         IF B 1 \=/
  47.         THEN 47 CHR + B \->STR +
  48.         END 42 CHR +
  49.       END 131 CHR +
  50.       IF D 1 \=/
  51.       THEN 40 CHR + C \->STR + 47 CHR + D \->STR + 41 CHR +
  52.       ELSE C \->STR +
  53.       END 39 CHR + OBJ\->
  54.     \>>
  55.   J 23
  56.   K 13279128
  57.   A 1
  58.   B 2
  59.   C 23
  60.   D 3319782
  61.   INFO
  62. " * * I N F O * *
  63. This directory
  64. contains 4 programs:
  65.   \->RDCL - Execute
  66. this program It uses
  67. the other 3 to find a
  68. simplified radical
  69. expression in the
  70. form a/b*\v/(c/d) that
  71. is == the input.
  72.   FCTOR - Factors out
  73. perfect squares from
  74. the numerator &
  75. denominator of the
  76. fraction made by \->Q
  77. from the square of
  78. the input.
  79.   SIMPL - Performs
  80. several operations on
  81. the result, in order
  82. to simplify the final
  83. expression.
  84.  B.A.E. - completes
  85. simplification & then
  86. builds the alebraic
  87. expression from the 4
  88. variables of the
  89. answer (A,B,C,D)."
  90.   ORD
  91.     \<< { \->RDCL FCTOR SIMPL B.A.E. J K A B C D INFO ORD } ORDER
  92.     \>>
  93.   T .633865691047
  94.   PPAR { (-6.5,-3.1) (6.5,3.2) X 0 (0,0) FUNCTION Y }
  95. END
  96.  
  97.